// get list of recommended tracks from last paragraph of cd review
// expects format "recommended tracks: one, two, three"
var recommended = $('#content').not('#comments').not('#related_posts').children('p:last').text().split(':')[1].trim();
var recommended = recommended.split(',');

// takes the input string, trims it, changes it to lowercase, and
// removes special characters - basically prepares it for comparison 
function clean_string(dirty_string) {
	dirty_string =  dirty_string.toLowerCase().trim();
	dirty_string =  dirty_string.replace(/[^a-zA-Z 0-9]+/g, '');
	return dirty_string;
}

// trim each object of whitespace for string comparison		
// convert to lowercase to avoid case sensitivity
// remove special characters like quotes or apostrophes
for(var i = 0; i < recommended.length; i++) {
	recommended[i] = clean_string(recommended[i]);
}

// go through each listed track and highlight recommended tracks
$('#cd_info ol li').each(function(index) {
	var track = clean_string($(this).text());
	if (jQuery.inArray(track, recommended) > -1) {
		$(this).addClass('rec');
	}
});